package org.hutb.community.util;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

import javax.print.DocFlavor;
import java.util.UUID;

/**
 * @ClassName CommunityUtil
 * @Description
 * @Author xubo
 * @Date 2021/11/25 23:36
 */
public class CommunityUtil {

    public static String generateUUID(){
        return UUID.randomUUID().toString().replace("-","");
    }

    //MD5加密
    public static String md5(String key){
        //判断key是否为空
        if (StringUtils.isBlank(key)){
            return null;
        }
        return DigestUtils.md5DigestAsHex(key.getBytes());
    }
}
